#ifndef SESSION_MANAGER_H
#define SESSION_MANAGER_H

#include <QObject>
#include <QVariant>

namespace network {
class LoginRequest;
class Response;
class Connection;
}
namespace Session {

class Manager : public QObject
{
    Q_OBJECT
public:
    explicit Manager(QObject *parent = 0);

signals:
    void logined(bool successed, QString message, QVariant data);
    void received();
public:
    bool login(const QString &user, const QString &password);
    bool logout();
private slots:
    void onResponsed(network::Response *response);
    void onConnected();
    void onDisconnected();
public:
    static Manager *instance(QObject *parent = 0);
private:
    static Manager *m_instance;
private:
    network::LoginRequest *m_loginRequest;
    QString m_sessionKey;
};

}
#endif // SESSION_MANAGER_H
